package org.example.backend.service.test;


import org.example.backend.entity.Users;
import org.example.backend.mapper.UsersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class userService implements CommandLineRunner {
    @Autowired
    private UsersMapper usersMapper;


    @Override
    public void run(String... args) throws Exception {
        Users user = new Users();
        List<Users> userList;

//        user=usersMapper.searchAllByUsername("aaa");
        user=usersMapper.searchAllByEmail("bbb");
        System.out.println(user);

////        user = usersMapper.searchAllByUsername("aaa");
//        userList=usersMapper.searchAllByUsernameAndEmail("111", "bbb");
//        userList.forEach(System.out::println);
//
//        //isEmpty()不包含元素则返回true
//        if(!userList.isEmpty()) {
//            System.out.println("用户已存在");
//        }
//        System.out.println(user);
    }
}
